﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using BluewaterSoft.Notepad.Common;
using Windows.Storage;

namespace BluewaterSoft.Notepad.Data
{
  public class TextContentData : BindableBase
  {

    private StorageFile _storageFile;
    public StorageFile StorageFile {
      get { return this._storageFile; }
      set { base.SetProperty<StorageFile>(ref this._storageFile, value); }
    }


    private string _textContent;
    public string TextContent
    {
      get { return this._textContent; }
      set
      {
        if (!this._isChanged)
        {
          if (this._firstLoaded && this._textContent != value)
            this._isChanged = true;
          else if (string.IsNullOrEmpty(this._textContent) && value != null)
            this._firstLoaded = true;
        }

        base.SetProperty<string>(ref this._textContent, value);
      }
    }


    private bool _firstLoaded;
    private bool _isChanged;
    public bool IsChanged {
      get { return this._isChanged; }
    }


  }
}
